//
//  OPHomeViewController.m
//  MyOne3
//
//  Created by meilbn on 2/20/16.
//  Copyright © 2016 meilbn. All rights reserved.
//

#import "OPHomeViewController.h"
#import "Masonry.h"

@interface OPHomeViewController ()

@property (nonatomic, weak) UIScrollView *scrollView;


@end

@implementation OPHomeViewController

- (NSString *)title
{
    return @"one";
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setView];
    [self setscrollView];
 
    
}
//设置View的一些属性
- (void)setView
{
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nav_home_title"]];
    self.navigationItem.titleView = imageView;
    
    self.view.backgroundColor = [UIColor colorWithRed:250/255.0 green:252/255.0 blue:255/255.0 alpha:1];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_search"] style:UIBarButtonItemStylePlain target:self action:@selector(searchOther)];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nav_me_normal"] style:UIBarButtonItemStylePlain target:self action:@selector(himMySelf)];
    
    UIButton *diary = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [diary setImage:[UIImage imageNamed:@"diary_normal"] forState:UIControlStateNormal];
//    [diary setTitle:@"小记" forState:UIControlStateNormal];
    [self.view addSubview:diary];
    [diary mas_makeConstraints:^(MASConstraintMaker *make) {
        make.size.sizeOffset(CGSizeMake(66, 44));
        make.left.equalTo(self.view).offset(10);
        make.bottom.equalTo(self.view).offset(-100);
    }];
    
    UIButton *share_image = [UIButton buttonWithType:UIButtonTypeCustom];
    [share_image setImage:[UIImage imageNamed:@"share_image"] forState:UIControlStateNormal];
    [self.view addSubview:share_image];
    [share_image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view).offset(-20);
        make.bottom.equalTo(self.view).offset(-100);
        make.size.sizeOffset(CGSizeMake(44, 44));
    }];
    
    
    UIButton *like_normal = [UIButton buttonWithType:UIButtonTypeCustom];
    [like_normal setTitle:@"37571" forState:UIControlStateNormal];
    [like_normal setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
    [like_normal setImage:[UIImage imageNamed:@"like_normal"] forState:UIControlStateNormal];
    [like_normal setImage:[UIImage imageNamed:@"like_selected"] forState:UIControlStateSelected];
    like_normal.titleLabel.font = [UIFont systemFontOfSize:12];
    [self.view addSubview:like_normal];
    [like_normal mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(share_image).offset(-50);
        make.bottom.equalTo(self.view).offset(-100);
        make.size.sizeOffset(CGSizeMake(100, 44));
    }];
}

- (void)searchOther
{
    
}
- (void)himMySelf
{
    
}
//设置scrollView的属性
- (void)setscrollView
{
    UIScrollView *scrollview = [[UIScrollView alloc] init];
    scrollview.frame  = self.view.bounds;
    scrollview.backgroundColor = [UIColor clearColor];
    scrollview.contentSize = CGSizeMake( self.view.width *5, self.view.height);
    [self.view addSubview:scrollview];
    scrollview.userInteractionEnabled = YES;
    self.scrollView = scrollview;
}
@end
